package com.RecipeBook.cooking;

import java.io.IOException;
import java.util.ArrayList;

import android.database.SQLException;
import android.os.Bundle;
import android.widget.ArrayAdapter;
import android.widget.ListView;

import com.RecipeBook.browse.DataBaseHelper;
import com.RecipeBook.common.RecipeActivity;
import com.RecipeBook.main.R;

public class IngredientList extends RecipeActivity
{
	DataBaseHelper myDbHelper;
	
	public void onCreate(Bundle savedInstanceState) 
	{
		super.onCreate(savedInstanceState);
		setContentView(R.layout.ingredient_list);
		
		/*myDbHelper = new DataBaseHelper(this);
		try {

			myDbHelper.openDataBase();

		}catch(SQLException sqle){

			throw sqle;

		}*/

		ArrayList<String> names = this.getIntent().getStringArrayListExtra("names");
		//int[] amounts = this.getIntent().getIntArrayExtra("amounts");
		//String[] units = this.getIntent().getStringArrayExtra("units");
		
		String[] display = new String[names.size()];
		int i = 0;
		for (String name : names)
		{
			display[i++] = name;
		}
		
		ArrayAdapter<String> ad=new ArrayAdapter<String>(this,android.R.layout.simple_list_item_single_choice,display);

		ListView temp = ((ListView)findViewById(R.id.ListView01));
		temp.setAdapter(ad);
	}
}
